home *** CD-ROM | disk | FTP | other *** search
/ Freelog 125 / Freelog_MarsAvril2015_No125.iso / Musique / Quod Libet / quodlibet-3.3.0-installer.exe / bin / quodlibet / ext / events / automask.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2014-12-31  |  2KB  |  49 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.7)
  3.  
  4. import os
  5. import gi
  6. gi.require_version('Gio', '2.0')
  7. from gi.repository import Gio
  8. from quodlibet import app
  9. from quodlibet.plugins.events import EventPlugin
  10.  
  11. class AutoMasking(EventPlugin):
  12.     PLUGIN_ID = 'automask'
  13.     PLUGIN_NAME = _('Automatic Masking')
  14.     PLUGIN_DESC = _('Automatically mask and unmask drives when they are unmounted or mounted.')
  15.     PLUGIN_VERSION = '0.1'
  16.     __sigs = None
  17.     __monitor = None
  18.     
  19.     def enabled(self):
  20.         if self._AutoMasking__monitor is None:
  21.             self._AutoMasking__monitor = Gio.VolumeMonitor.get()
  22.             self._AutoMasking__sigs = [
  23.                 self._AutoMasking__monitor.connect('mount-added', self._AutoMasking__mounted),
  24.                 self._AutoMasking__monitor.connect('mount-removed', self._AutoMasking__unmounted)]
  25.         else:
  26.             for signal_id in self._AutoMasking__sigs:
  27.                 self._AutoMasking__monitor.handler_unblock(signal_id)
  28.             
  29.  
  30.     
  31.     def disabled(self):
  32.         for signal_id in self._AutoMasking__sigs:
  33.             self._AutoMasking__monitor.handler_unblock(signal_id)
  34.         
  35.  
  36.     
  37.     def __mounted(self, monitor, mount):
  38.         path = mount.get_default_location().get_path()
  39.         if path is not None:
  40.             app.library.unmask(os.path.normpath(path))
  41.  
  42.     
  43.     def __unmounted(self, monitor, mount):
  44.         path = mount.get_default_location().get_path()
  45.         if path is not None:
  46.             app.library.mask(os.path.normpath(path))
  47.  
  48.  
  49.